package group.systemdesign.Service.Impl;

import group.systemdesign.Config.VideoConfig;
import group.systemdesign.Mapper.VideoMapper;
import group.systemdesign.Pojo.Video;
import group.systemdesign.Service.VideoService;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoServiceImpl implements VideoService {
    @Autowired
    private VideoMapper videoMapper;
    @Autowired
    private VideoConfig videoConfig;
    //根据点赞数推荐
    @Override
    public List<Video> likesRecommend() {
        return videoMapper.likesRecommend();
    }

    @Override
    public List<Video> likesMusic() {
        return videoMapper.likesMusic();
    }

    @Override
    public List<Video> likesGame() {
        return videoMapper.likesGame();
    }

    @Override
    public List<Video> likesComic() {
        return videoMapper.likesComic();
    }

    @Override
    public List<Video> likesSports() {
        return videoMapper.likesSports();
    }

    @Override
    public List<Video> viewsMusic() {
        return videoMapper.viewsMusic();
    }

    @Override
    public List<Video> viewsGame() {
        return videoMapper.viewsGame();
    }

    @Override
    public List<Video> viewsComic() {
        return videoMapper.viewsComic();
    }

    @Override
    public List<Video> viewsSports() {
        return videoMapper.viewsSports();
    }

    @Override
    public List<Video> viewsRecommend() {
        return videoMapper.viewsRecommend();
    }

    @Override
    public List<Video> searchByName(String video_name) {
        return videoMapper.searchByName(video_name);
    }

    @Override
    public List<Video> history() {
        return videoConfig.getHistory();
    }

    @Override
    public Video addHistory(Integer id) {
        videoConfig.addVideoToHistory(videoMapper.addHistory(id));
        return videoMapper.addHistory(id);
    }
    @Override
    public List<Video> collection() {
        return videoConfig.getCollection();
    }

    @Override
    public Video addCollection(Integer id) {
        videoConfig.addCollection(videoMapper.addCollection(id));
        return videoMapper.addCollection(id);
    }
}
